class Structure < ActiveRecord::Base
	has_many :bookings, dependent: :destroy
	has_many :events, :through => :bookings
	
	validates_uniqueness_of :name
	validates :name, presence: true
	validates :typology, presence: true
	
	# getter for virtual attribute
	def typology_virtual
		self.typology
	end
	
	# setter for virtual attribute
	def typology_virtual=(t)
		self.typology = t.downcase
	end
end
